<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>活动抽奖</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
            color: #e0f7fa;
        }
        
        .lottery-container {
            background: rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(10px);
            padding: 40px;
            border-radius: 20px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            text-align: center;
            border: 1px solid rgba(255, 255, 255, 0.18);
            max-width: 500px;
            width: 90%;
        }
        
        h1 {
            color: #e0f7fa;
            margin-bottom: 30px;
            font-weight: 300;
            letter-spacing: 1px;
            text-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        
        .grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
            margin-bottom: 30px;
        }
        
        .card {
            width: 100%;
            height: 100px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 24px;
            font-weight: bold;
            color: rgba(255, 255, 255, 0.7);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        
        .card:hover {
            transform: translateY(-5px);
            background: rgba(255, 255, 255, 0.15);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        }
        
        .card.revealed {
            background: linear-gradient(135deg, #00b4db, #0083b0);
            color: white;
            cursor: not-allowed;
            box-shadow: 0 4px 15px rgba(0, 180, 219, 0.4);
        }
        
        .card.revealed::after {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(rgba(255,255,255,0.3), transparent);
            transform: rotate(30deg);
            animation: shine 1s ease-in-out;
        }
        
        @keyframes shine {
            0% { transform: translateX(-100%) translateY(-100%) rotate(30deg); }
            100% { transform: translateX(100%) translateY(100%) rotate(30deg); }
        }
        
        .result {
            font-size: 24px;
            color: #e0f7fa;
            margin-top: 20px;
            min-height: 30px;
            font-weight: 300;
            letter-spacing: 0.5px;
        }
        
        .reset-btn {
            background: linear-gradient(135deg, #00b4db, #0083b0);
            color: white;
            border: none;
            padding: 12px 30px;
            font-size: 16px;
            border-radius: 30px;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 20px;
            box-shadow: 0 4px 15px rgba(0, 180, 219, 0.3);
            letter-spacing: 0.5px;
        }
        
        .reset-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 20px rgba(0, 180, 219, 0.5);
        }
    </style>
</head>
<body>
    <div class="lottery-container">
        <h1>🎉 挂挂乐抽奖 🎉</h1>
        <div class="grid" id="grid">
            <!-- 卡片将通过JavaScript生成 -->
        </div>
        <div class="result" id="result"></div>
        <button class="reset-btn" onclick="resetGame()">重新开始</button>
    </div>

    <script>
        // 奖品数组
        const prizes = ['一等奖', '二等奖', '三等奖', '谢谢参与', '幸运奖', '再来一次', '特等奖', '安慰奖', '神秘奖'];
        
        // 打乱数组（洗牌算法）
        function shuffle(array) {
            for (let i = array.length - 1; i > 0; i--) {
                const j = Math.floor(Math.random() * (i + 1));
                [array[i], array[j]] = [array[j], array[i]];
            }
            return array;
        }
        
        // 初始化游戏
        function initGame() {
            const grid = document.getElementById('grid');
            grid.innerHTML = '';
            
            // 打乱奖品顺序
            const shuffledPrizes = shuffle([...prizes]);
            
            // 创建卡片
            shuffledPrizes.forEach((prize, index) => {
                const card = document.createElement('div');
                card.className = 'card';
                card.textContent = '?';
                card.dataset.prize = prize;
                card.dataset.index = index;
                card.addEventListener('click', revealCard);
                grid.appendChild(card);
            });
            
            document.getElementById('result').textContent = '';
        }
        
        // 揭示卡片
        function revealCard(e) {
            const card = e.target;
            if (card.classList.contains('revealed')) {
                return;
            }
            
            card.classList.add('revealed');
            card.textContent = card.dataset.prize;
            
            // 显示结果
            const result = document.getElementById('result');
            result.textContent = `恭喜您获得：${card.dataset.prize}！`;
            
            // 检查是否全部揭开
            checkAllRevealed();
        }
        
        // 检查是否全部揭开
        function checkAllRevealed() {
            const cards = document.querySelectorAll('.card');
            const allRevealed = Array.from(cards).every(card => card.classList.contains('revealed'));
            
            if (allRevealed) {
                setTimeout(() => {
                    document.getElementById('result').textContent += ' 所有奖品已揭晓！';
                }, 500);
            }
        }
        
        // 重置游戏
        function resetGame() {
            initGame();
        }
        
        // 页面加载时初始化游戏
        window.onload = initGame;
    </script>
</body>
</html>










